WORD Fselect(WORD timeout, LONG *rfds, LONG *wfds, ((long)0));
rfds points to a long word which represents a set of GEMDOS file descriptors; bit n of this long word is set if file descriptor n is to be checked for input data. An empty set may optionally be represented by a NULL pointer instead of a pointer to 0. Similarly, wfds points to a 32 bit long word which indicates which file descriptors are to be checked for output status. When Fselect returns, the old values pointed to by rfds and wfds (if non-NULL) are overwritten by new long words indicating which file descriptors are actually ready for reading or writing; these will always form subsets of the file descriptors originally specified as being of interest.
timeout is a 16 bit unsigned integer specifying a maximum number of milliseconds to wait before returning; if this number is 0, no maximum is set and the call will block until one of the file descriptors specified is ready for reading or writing, as appropriate. Thus, Fselect(0,0L,0L,0L) will block forever, whereas Fselect(1,0L,0L,0L) will pause for 1 millisecond.
The final argument, a long word, must always be 0 (it is reserved for future enhancements).
EIHNDL if any handle specified by the long words pointed to by rfds or wfds is not a valid (open) GEMDOS handle.
Fselect does not work correctly on any BIOS device except the keyboard.
Note that if an error condition occurs on one of the file descriptors (for example, if the read status of a pipe with no more writers is being requested) then Fselect will mark that file descriptor as being ready for reading (or writing, as appropriate). This is not strictly speaking a bug, since a subsequent read will not block (it will return an error condition), but programmers should be aware of the possibility.